home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1913 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.6 KB  |  66 lines

  1. Path: galileo.carl.org!echadez
  2. From: echadez@galileo.carl.org (Edward Chadez)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Datatypes, datatypes, datatypes
  5. Date: 24 Jan 1996 23:16:11 GMT
  6. Organization: CARL Corporation
  7. Message-ID: <4e6ejs$k9o@hermes.cair.du.edu>
  8. NNTP-Posting-Host: galileo.carl.org
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=US-ASCII
  11. Content-Transfer-Encoding: 7bit
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. I have two problems with using datatypes (for image conversion) that perhaps 
  15. someone here might have the answer to.
  16.  
  17. The first problem is converting a GIF with only 16 colors to display on a
  18. screen of 256 colors.  (An example of a GIF with only 16 colors is the
  19. 'Aminet.gif' logo at http://ftp.wustl.edu/~aminet/)
  20.  
  21. struct Screen *screen;  // points to an open screen, depth = 8 (256 color)
  22. char *file_name;        // points to a string array with a valid filename
  23.  
  24.        obj = NewDTObject(file_name,
  25.                          DTA_SourceType,    DTST_FILE,
  26.                          DTA_GroupID,        GID_PICTURE,
  27.                          PDTA_Remap,        TRUE,
  28.                          PDTA_Screen,       screen,
  29.                          OBP_Precision,     PRECISION_EXACT,
  30.                          TAG_DONE);
  31.  
  32. I know that the object has been created, I can examine the BitMapHeader and
  33. see that the depth = 4.  I convert the object to a bitmap via the call:
  34.  
  35.             if (GetDTAttrs(obj,
  36.                            PDTA_BitMap, &bmap,
  37.                            TAG_DONE);
  38.  
  39. However, when I blit this bitmap into a new bitmap into the window's 
  40. rastport with a minturn of 0xE0 (or 0xC0), I get an image with false 
  41. colors, as if it's trying to account for all 8 bitplanes when there are 
  42. only 4.  I've tried using BltBitMap with various masks (7, 15, 65) but 
  43. I get the same results (using a mask of 1 or 3 provides different, but
  44. still incorrect results).
  45.  
  46. Note that I don't have problems with 256 color gifs.
  47.  
  48. ==    ==    ==    ==    ==    ==    ==    ==    ==    ==    ==    ==    ==
  49.  
  50. My second problem: is there an easy way to build a mask from a bitmap with
  51. a transparent attribute by just knowing the transparent color?
  52.  
  53. I'd like to convert a gif (with a transparent color) to a bitmap and 
  54. then blit it to another bitmap, ignoring (ie, masking) the areas with
  55. the transparent color.  (If there's an easier way to do this, I'm all
  56. ears....)
  57.  
  58. As always...thanks in advance.
  59.  
  60.     -Ed
  61. --
  62. What you percieve here as opinions aren't readily shared by those I work for.
  63.      Edward Chadez, Lead Senior Programmer/Analyst at CARL Corporation
  64.    When web surfing, visit Galileo's Universe at http://galileo.carl.org/
  65.    Amiga user since 1988.  Internet surfer since 1989.  Grow up, not old.
  66.